from django.db.models import Count

from user.models import User

def get_top_liked_users(n=5):
    """
      返回关注人数排名前五的用户。
      """
    top_users = User.objects.annotate(
        concern_count=Count('user_concern', distinct=True)
    ).order_by('-concern_count')[:5]

    return top_users



